home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / demos / retinarave / include / linedraw.i < prev    next >
Text File  |  1980-01-03  |  2KB  |  114 lines

  1. * This the Amiga System Programmers Guild, Line Draw routine.
  2.  
  3. Dmaconr    equ    $002
  4. Bltbmod    equ    $062
  5. Bltapth    equ    $050
  6. Bltamod    equ    $064
  7. Bltcon0    equ    $040
  8. Bltcon1    equ    $042
  9. Bltcmod    equ    $060
  10. Bltdmod    equ    $066
  11. Bltadat    equ    $074
  12. Bltafwm    equ    $044
  13. Bltbdat    equ    $072
  14. Bltcpth    equ    $048
  15. Bltdpth    equ    $054
  16. Bltsize    equ    $058
  17. bltaptl    equ    $52
  18.  
  19. *    *    *    *    *    *    *    *    *    *
  20. * d0 = X1, d1= Y1, d2= X2, d3= Y2
  21. * a0 = bitplane
  22. * a1 = width in bytes
  23. * a2 = word written to mask register $FFFF
  24. * d4, d6 used.
  25. *    *    *    *    *    *    *    *    *    *
  26.  
  27. DrawLine:
  28.     move.l    #$dff000,a5
  29.  
  30.     move.l    a1,d4
  31.     mulu    d1,d4
  32.     moveq    #-$10,d5
  33.     and.w    d0,d5
  34.     lsr.w    #3,d5
  35.     add.w    d5,d4
  36.     add.l    a0,d4
  37.  
  38.     clr.l    d5
  39.     sub.w    d1,d3
  40.     roxl.b    #1,d5
  41.     tst.w    d3
  42.     bge.s    y2gy1
  43.     neg.w    d3
  44. y2gy1:
  45.     sub.w    d0,d2
  46.     roxl.b    #1,d5
  47.     tst.w    d2
  48.     bge.s    x2gx1
  49.     neg.w    d2
  50. x2gx1:
  51.     move.w    d3,d1
  52.     sub.w    d2,d1
  53.     bge.s    dygdx
  54.     exg    d2,d3
  55. dygdx:
  56.     roxl.b    #1,d5
  57.     move.b    Octant_table(pc,d5),d5
  58.     add.w    d2,d2
  59.  
  60. WBlit:    btst    #14,dmaconr(a5)
  61.     bne.s    WBlit
  62.  
  63.     move.w    d2,bltbmod(a5)
  64.     sub.w    d3,d2
  65.     bge.s    signn1
  66.  
  67.     or.b    #$40,d5
  68. signn1:    move.w    d2,bltaptl(a5)
  69.     sub.w    d3,d2
  70.     move.w    d2,bltamod(a5)
  71.  
  72.     move.w    #$8000,bltadat(a5)
  73.     move.w    a2,bltbdat(a5)
  74.     move.w    #$ffff,bltafwm(a5)
  75.     and.w    #$000f,d0
  76.     ror.w    #4,d0
  77.     or.w    #$0bca,d0
  78.     move.w    d0,bltcon0(a5)
  79.     move.w    d5,bltcon1(a5)
  80.     move.l    d4,bltcpth(a5)
  81.     move.l    d4,bltdpth(a5)
  82.     move.w    a1,bltcmod(a5)
  83.     move.w    a1,bltdmod(a5)
  84.  
  85.     lsl.w    #6,d3
  86.     addq.w    #2,d3
  87.     move.w    d3,bltsize(a5)
  88.  
  89.     rts
  90.  
  91. * Normal Lines.
  92. Octant_table:
  93.     dc.b    0*4+1
  94.     dc.b    4*4+1
  95.     dc.b    2*4+1
  96.     dc.b    5*4+1
  97.     dc.b    1*4+1
  98.     dc.b    6*4+1
  99.     dc.b    3*4+1
  100.     dc.b    7*4+1
  101.  
  102. * Lines for filling with the blitter.
  103.  
  104. ;    DC.B    0*4+3
  105. ;    DC.B    4*4+3
  106. ;    DC.B    2*4+3
  107. ;    DC.B    5*4+3
  108. ;    DC.B    1*4+3
  109. ;    DC.B    6*4+3
  110. ;    DC.B    3*4+3
  111. ;    DC.B    7*4+3
  112.     
  113. *    *    *    *    *    *    *    *    *    *
  114.